package legoproject.TestStubs;

import legoproject.*;
import java.awt.*;
import javax.swing.*;

class SimpleButton extends JPanel {

    private JRadioButton downButton;

    public SimpleButton(String name, boolean startValue) {
        super(new BorderLayout());
        add(new Label(name), BorderLayout.NORTH);
        downButton = new JRadioButton("down");
        if(!startValue) downButton.setSelected(true);
        JRadioButton upButton = new JRadioButton("up");
        if(startValue) upButton.setSelected(true);
        ButtonGroup group = new ButtonGroup();
        group.add(upButton);
        group.add(downButton);
        JPanel radioPanel = new JPanel(new GridLayout(0, 1));
        radioPanel.add(downButton);
        radioPanel.add(upButton);
        radioPanel.setOpaque(true);
        add(radioPanel, BorderLayout.SOUTH);
        setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
    }

    public boolean isDown() {
        return downButton.isSelected();
    }
}